<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use kartik\file\FileInput;//图片上传
use \kucha\ueditor\UEditor;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Expert\Expert */
/* @var $form yii\widgets\ActiveForm */

?>
<style>
 .kv-file-content img{ width: 100%!important; }
 </style>
<div class="expert-form">

    <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'],'id'=>'subform']); ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'password')->textInput(['maxlength' => true]) ?>

     <?= $form->field($model, 'sex')->dropDownList(array('男'=>'男','女'=>'女')) ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
    <?php
            if(isset(json_decode($model->zhaopian)->newname)){
                $img = json_decode($model->zhaopian)->newname;
            }else{
                $img = $model->zhaopian;
            }
            $siteRoot = Yii::$app->params['qtimg'];
            echo '<label class="control-label">照片(格式:98**98,以像在图片中部的半身像为佳)</label>;';
            echo FileInput::widget([
                'model' => $model,
                'attribute' => 'zhaopian',
                'options' => ['accept' => 'image/*'],
                'pluginOptions' => [
                    'uploadExtraData' => [
                        'album_id' => 20,
                        'cat_id' => 'Nature'
                    ],
                    'initialPreview'=>[
                        !empty($img)?Html::img(Yii::$app->params['qtimg'].$img):null,
                    ],
                    'initialCaption'=> $img,
                    'maxFileCount' => 10,
                    "showUpload"=> false,
                ]
            ]);
            ?> 

    <?= $form->field($model, 'telephone')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'compamy')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'zhiwu')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'birthday')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'comefrom')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'bnumber')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'loc_town')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'chengguo')->widget('kucha\ueditor\UEditor',[]) ?>

    <?= $form->field($model, 'reason')->widget('kucha\ueditor\UEditor',[]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
